home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-04-18 | 1.7 KB | 94 lines | [TEXT/PJMM] |
- {Dimming demo}
- {Converted to Pascal 1995 by IR}
-
- program Dim;
-
- uses
- Dim_text;
-
- { dialog item numbers}
- const
- i_done = 1;
- i_title = 2;
- i_checkbox1 = 3;
- i_checkbox2 = 4;
- i_stat1 = 5;
- i_edit1 = 6;
- i_edit3 = 7;
- i_stat2 = 8;
- i_edit2 = 9;
- i_refresh = 10;
-
-
- procedure ToolBoxInit;
- begin
- {$IFC UNDEFINED THINK_PASCAL}
- InitGraf(@qd.thePort);
- InitFonts;
- FlushEvents(everyEvent, o);
- InitWindows;
- InitMenus;
- TEInit;
- InitDialogs(nil);
- {$ENDC}
- InitCursor;
- end; {ToolBoxInit}
-
-
- {main program}
-
- var
- dp: DialogPtr;
- checkbox1, checkbox2: ControlHandle;
- iRect: Rect;
- iType, hit: Integer;
- val: Boolean;
- apple_menu: MenuHandle;
-
- begin
- ToolBoxInit;
- apple_menu := NewMenu(128, stringof(char($14)));
- AppendMenu(apple_menu, 'Yo;(-');
- AddResMenu(apple_menu, 'DRVR');
- InsertMenu(apple_menu, 0);
- DrawMenuBar;
-
- dp := GetNewDialog(128, nil, WindowPtr(-1));
- SetPort(dp);
- GetDItem(dp, i_checkbox1, iType, Handle(checkbox1), iRect);
- GetDItem(dp, i_checkbox2, iType, Handle(checkbox2), iRect);
- Init_dimmer(dp);
-
- ShowWindow(dp);
- repeat
-
- ModalDialog(nil, hit);
- case hit of
- i_checkbox1:
- begin
- val := not Boolean(GetCtlValue(checkbox1));
- SetCtlValue(checkbox1, Integer(val));
- Dim_text(dp, i_stat1, val);
- Dim_text(dp, i_edit1, val);
- Dim_text(dp, i_edit3, val);
- end;
-
- i_checkbox2:
- begin
- val := not Boolean(GetCtlValue(checkbox2));
- SetCtlValue(checkbox2, Integer(val));
- Dim_text(dp, i_stat2, val);
- Dim_text(dp, i_edit2, val);
- end;
-
- i_refresh:
- begin
- EraseRect(dp^.portRect);
- InvalRect(dp^.portRect);
- end;
- end; {case}
- until hit = i_done;
-
- Dispose_dimmer(dp);
- DisposeDialog(dp);
- end.